{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_setting_course' %}
{% set script_controller = 'setting/course' %}

{% block main %}


{{ web_macro.flash_messages() }}

<form class="form-horizontal" method="post" id="course-form" novalidate>

  <fieldset>
    <legend>课程规则</legend>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >
          {{'给新'|trans}}{{'%user_name%发送欢迎私信'|trans({'%user_name%': setting('default.user_name')|default('学员'|trans)})}}
        </label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('welcome_message_enabled', {1:'开启'|trans, 0:'关闭'|trans}, courseSetting.welcome_message_enabled) }}
      <p class="help-block">
        {{'开启后，新'|trans}}{{'%user_name%加入课程后，会收到教师的欢迎私信'|trans({'%user_name%': setting('default.user_name')|default('学员'|trans)})}}
      </p>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label for="welcome_message_body">{{'欢迎私信内容'|trans}}</label>
      </div>
      <div class="controls col-md-8">
        <textarea id="welcome_message_body" name="welcome_message_body" class="form-control" rows="5">{{ courseSetting.welcome_message_body }}</textarea>
        <div class="help-block">

          <div>{{'变量说明：'|trans}}</div>
          <ul>
            <li>{% verbatim %}{{nickname}}{% endverbatim %} {{'为接收方用户用户名'|trans}}</li>
            <li>{% verbatim %}{{course}}{% endverbatim %} {{'为课程名称'|trans}}</li>
          </ul>

        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>{{'课程详情页显示相关课程'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('relatedCourses', {1:'开启', 0:'关闭'}, courseSetting.relatedCourses) }}
        <div class="help-block">{{'根据课程的标签，显示相关课程'|trans}}</div>
      </div>
    </div>
  </fieldset>

  <fieldset>
    <legend>权限与版权</legend>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'允许教师设置课程价格'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_modify_price', {1:'是'|trans, 0:'否'|trans}, courseSetting.teacher_modify_price) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'允许教师查询课程订单'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_search_order', {1:'是'|trans, 0:'否'|trans}, courseSetting.teacher_search_order) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'允许教师添加/移除'|trans}}{{setting('default.user_name')|default('学员'|trans)}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_manage_student', {1:'是'|trans, 0:'否'|trans}, courseSetting.teacher_manage_student) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'允许教师导出'|trans}}{{'%user_name%资料'|trans({'%user_name%': setting('default.user_name')|default('学员'|trans)})}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_export_student', {1:'是'|trans, 0:'否'|trans}, courseSetting.teacher_export_student) }}
      </div>
    </div>
    {% set smsSetting = setting('cloud_sms') %}
    {% if smsSetting.sms_enabled|default(0) and (smsSetting.sms_normal_lesson_publish|default('off') == 'on' or smsSetting.sms_live_lesson_publish|default('off') == 'on')%}
    {% endif %}


    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'允许'|trans}}{{'%user_name%下载课时的音视频'|trans({'%user_name%': setting('default.user_name')|default('学员'|trans)})}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('student_download_media', {0:'不允许'|trans, 1:'允许'|trans}, courseSetting.student_download_media) }}
        <div class="help-block">{{'开启此项设置后，'|trans}}{{'%user_name%可在课时学习界面侧栏的"资料"面板中下载。'|trans({'%user_name%': setting('default.user_name')|default('学员'|trans)})}}</div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >{{'课程列表页默认排序'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('explore_default_orderBy', {latest:'最新'|trans, studentNum:'最热'|trans,recommendedSeq:'推荐'|trans}, courseSetting.explore_default_orderBy) }}
        <p class="help-block"><a target="_blank" href="{{ path('course_explore') }}">课程列表页</a>地址：域名/course/explore,任何人都可在此页面查看网站所有已发布课程,如需设置网站首页课程排序，请到【站点设置】-【主题】-【管理】中设置，目前仅简墨和雅致简洁主题支持。</p>
      </div>
    </div>

     <div class="form-group">
      <div class="col-md-3 control-label">
        <label>{{'图文、文档课时防复制'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('copy_enabled', {1:'开启'|trans, 0:'关闭'|trans}, courseSetting.copy_enabled) }}
        <div class="help-block"></div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>{{'试卷防复制'|trans}}</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('testpaperCopy_enabled', {1:'开启'|trans, 0:'关闭'|trans}, courseSetting.testpaperCopy_enabled) }}
        <div class="help-block"></div>
      </div>
    </div>

  </fieldset>

  <fieldset>
    <legend>课程运营模式</legend>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>免费试看/免费课时允许未登录用户观看</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('allowAnonymousPreview', {1:'允许', 0:'不允许'}, courseSetting.allowAnonymousPreview) }}
        <div class="help-block">如果允许此项设置，未登录用户（游客）可观看免费试看/免费课时</div>
      </div>
    </div>

    <div class="form-group">
      <label class="col-md-3 control-label">{{'课程中允许显示%user_name%人数'|trans({'%user_name%': setting('default.user_name', '学员'|trans)})}}</label>
      <div class="col-md-8 controls radios">
        {{ radios('show_student_num_enabled', {'1':'开启'|trans, '0':'关闭'|trans}, courseSetting.show_student_num_enabled|default('1') ) }}
      </div>
    </div>

  </fieldset>

  <fieldset>
      <legend>{{'名称设置'|trans}}</legend>

        <div class="form-group">
          <div class="col-md-3 control-label">
            <label>{{'设置章节名称'|trans}}</label>
          </div>
          <div class="controls col-md-8 radios">
            {{ radios('custom_chapter_enabled', {1:'开启'|trans, 0:'关闭'|trans}, courseSetting.custom_chapter_enabled) }}
            <div class="help-block">
              {{'开启后，在课时管理中添加章,节时，系统会自动生成按如下设置的章节名称。'|trans}}</div>
          </div>
        </div>

      <div id="show_course_chapter_name"  style="display: {% if  courseSetting.custom_chapter_enabled %} block {% else %} none {% endif %};">
        <div class="form-group">
          <div class="col-md-3 control-label">
              <label for="chapter_name">{{'课程章名称'|trans}}</label>
          </div>
          <div class="controls col-md-4">
            <input  type="text" id="chapter_name" name="chapter_name" class="form-control" {% if defaultSetting.chapter_name %}value="{{defaultSetting.chapter_name}}" {% else %} value="{{'章'|trans}}" {% endif %}>
          </div>
        </div>

        <div class="row form-group">
          <div class="col-md-3 control-label">
              <label for="part_name">{{'课程节名称'|trans}}</label>
          </div>
          <div class="controls col-md-4">
            <input  type="text" id="part_name" name="part_name" class="form-control" {% if defaultSetting.part_name %} value="{{defaultSetting.part_name}}" {% else %} value="{{'节'|trans}}" {% endif %}>
          </div>
        </div>
      </div>
    <div class="alert alert-info deduction text-center">
    <p><strong>
    {{'注：修改网校字段后，站内相关字段名称都会相应修改为已保存的名称'|trans}}
    </strong></p>
    </div>

  </fieldset>

  <div class="form-group">
    <div class="controls col-md-offset-3 col-md-8">
      <button type="submit" class="btn btn-primary">{{'提交'|trans}}</button>
    </div>
  </div>
  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
</form>

{% endblock %}



